package com.zjy.software.day11.chain;

import com.zjy.software.day11.MyRuntimeException;

public class ChainTest {
    public static void main(String[] args) {
        testServiceException();
    }

    private static void testNetException() {
        String message = "网络异常";
        if ("网络异常".equals(message)) {
            throw new NetRuntimeExcetpion(message);
        }
    }

    private static void testDBException() {
       try {
          testNetException();
       }catch (NetRuntimeExcetpion e){
           throw new DBRuntimeException("数据库异常",e);
       }
    }
    private static void testNullException() {
        try {
            testDBException();
        } catch (DBRuntimeException e) {
            throw new MyRuntimeException("空指针异常",e);
        }
    }
        private static void testServiceException() {
            try {
                testNullException();
            }catch (MyRuntimeException e){
                throw new ZJYRuntimeException("紫金云异常",e);
            }
    }

}
